﻿/* ######################################## *\
 * ### Copyright (C) 2009 AJ Ravindiran ### *
\* ######################################## */
using System;

namespace AJRavindiran.Jolt.RuneScape.Models.Characters.Update
{
    /// <summary>
    /// Represents player update flags.
    /// </summary>
    public class UpdateFlags
    {
        #region Properties
        /// <summary>
        /// Gets or sets the character's last region.
        /// </summary>
        public Information.Location LastRegion { get; set; }

        /// <summary>
        /// Gets or sets the character's face to value.
        /// </summary>
        public int FaceTo { get; set; }
        /// <summary>
        /// Gets or sets whether the character needs to clear the face to request.
        /// </summary>
        public bool ClearFaceTo { get; set; }
        /// <summary>
        /// Gets or sets whether the character teleported.
        /// </summary>
        public bool DidTeleport { get; set; }
        /// <summary>
        /// Gets or sets whether the map region changed.
        /// </summary>
        public bool DidMapRegionChange { get; set; }
        /// <summary>
        /// Gets or sets whether we need to update the faceto request.
        /// </summary>
        public bool FaceToUpdateRequired { get; set; }
        /// <summary>
        /// Gets or sets whether we need to update the appearance request.
        /// </summary>
        public bool AppearanceUpdateRequired { get; set; }
        /// <summary>
        /// Gets or sets whether we need to update the chat text request.
        /// </summary>
        public bool ChatTextUpdateRequired { get; set; }
        /// <summary>
        /// Gets or sets whether we need to udpate the animation request.
        /// </summary>
        public bool AnimationUpdateRequired { get; set; }
        /// <summary>
        /// Gets or sets whether we need to udpate the graphics request.
        /// </summary>
        public bool GraphicsUpdateRequired { get; set; }
        #endregion Properties

        #region Constructor
        /// <summary>
        /// Constructs a new update flags class.
        /// </summary>
        public UpdateFlags()
        {
            this.ClearFlags();
            this.ClearFaceTo = false;
        }
        #endregion Constructor

        #region Methods
        /// <summary>
        /// Clears the update flags.
        /// </summary>
        public void ClearFlags()
        {
            this.FaceTo = -1;
            this.FaceToUpdateRequired = false;
            this.AppearanceUpdateRequired = false;
            this.DidTeleport = false;
            this.DidMapRegionChange = false;
            this.ChatTextUpdateRequired = false;
            this.AnimationUpdateRequired = false;
            this.GraphicsUpdateRequired = false;
        }

        /// <summary>
        /// True if one of these values are true.
        /// </summary>
        public bool IsUpdateRequired()
        {
            return this.FaceToUpdateRequired 
                || this.AppearanceUpdateRequired 
                || this.ChatTextUpdateRequired 
                || this.AnimationUpdateRequired 
                || this.GraphicsUpdateRequired;
        }
        #endregion Methods
    }
}